package br.ufrn.engcomp.jsf;

import java.io.File;
import java.io.IOException;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import org.apache.commons.io.FileUtils;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.UploadedFile;

@ManagedBean
@SessionScoped
public class ControladorMBean extends AbstractMBean {

    // private ControllerInterface controller;
    // private List<ControllerInterface> controllersList;

    public ControladorMBean() {
	// this.controller = new PIDController();
	// this.setControllersList(new ArrayList<ControllerInterface>());
    }

    public String cadastrarControlador() {
	// controllerDAO.salvar(controller);
	return null;
    }

    public void sayHi() {
	System.out.println("SAY HI!!!");
    }

    public void handleFileUpload(FileUploadEvent event) throws IOException {

	UploadedFile file = event.getFile();
	File _file = new File("kdkd");
	FileUtils.copyInputStreamToFile(file.getInputstream(), _file);
	// controladorBD.setJar(_file);
	// controladorBD.setJarFile(file.getContents());
    }

    // public List<ControllerInterface> getControllersList() {
    // return controllersList;
    // }

    // public void setControllersList(List<ControllerInterface> controllersList)
    // {
    // this.controllersList = controllersList;
    // }

}
